<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="../css/mescroll.min.css"/>
		<link rel="stylesheet" type="text/css" href="../css/pages/tenement.css"/>
	</head>

	<body>

		<div id="mescroll" class="mescroll">
			<div id="app" class="content">
				<div class="pay-desc font-14 font-c-7f" v-text="hosing.neiName+hosing.buiName+hosing.eleName+hosing.roomEncode"></div>
				<ul class="mui-table-view">
					<li class="mui-table-view-cell" v-for="item in bills" @click="onBillDetail(item)">
						<div>
							<div class="font-16 font-c-41" v-text="item.year+ '年 - ' + item.month + '月' "></div>
							<div class="font-12 font-c-min">￥{{item.money}}元</div>
						</div>
						<span class="mui-icon mui-icon-arrowright"></span>
					</li>
				</ul>
			</div>
		</div>

		<script src="../js/Width.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/mescroll.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="../js/Util.js" type="text/javascript" charset="utf-8"></script>
		<script src="https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js"></script>
		<script type="text/javascript">
			mui.init()
			var hosing = null; // 用户信息
			
			mui.plusReady(function() {
				hosing = Util.getState('hosing');
				app.hosing = hosing;
				
				ws = plus.webview.currentWebview();
				ws.setStyle({
					titleNView: {
						titleText: "账单",
						autoBackButton: true,
						backgroundColor: "#fff"
					}
				})
				
				if (mui.os.ios) { //判断是ios还是安卓设备
					FastClick.attach(document.body);
				}
				
				mescroll = new MeScroll("mescroll", {
					down: {
						auto: false,
						callback: downCallback
					},
					up: {
						callback: upCallback,
						page: {
							num: 0,
							size: 10
						},
						empty: {
							warpId: "mescroll",
							icon: "../images/zanwu.png",
							tip: "你还没有发布呢~",
							btntext: "",
							btnClick: null,
							supportTap: false
						},
						htmlNodata: '<p class="upwarp-nodata">-- 我也是有底线的 --</p>'
					}
				})
				
			})

			var app = new Vue({
				el: '#app',
				data: {
					hosing: {},
					bills: []
				}, 
				methods: {
					onBillDetail(item) {
						mui.openWindow({
							url: 'home/PropertyPayCost/bill-detail.html',
							id: 'bill-detail',
							waiting: {
								autoShow: false
							},
							extras: {
								year: item.year,
								month: item.month
							},
						})
					}
				
				}
			})
			
			function downCallback() {
				app.bills = []
				mescroll.resetUpScroll();
			}
			
			function upCallback(page) {
				mui.post(Util.HTTP + 'api/Bill/GetPaymentHistory',{
					neiID: hosing.neiID,
					buiID: hosing.buiID,
					eleID: hosing.eleID,
					roomID: hosing.roomID,
					userID: hosing.userID,
					page: page.num,
					number: page.size
				},function(res){
					if(res.code==1001){
						mescroll.endSuccess(res.data.length);
						app.bills = app.bills.concat(res.data)
						
					}else{
						mui.toast(res.message)
					}
				})
			}	
		</script>
	</body>
</html>
